package top.ahzy.seobench.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import top.ahzy.seobench.mapper.ConfigDataMapper;
import top.ahzy.seobench.util.AlyDdnsUtil;

import javax.annotation.Resource;

@Component
public class ConfigDataTask {

    @Resource
    ConfigDataMapper configDataMapper;

    @Autowired
    AlyDdnsUtil alyDdnsUtil;
    /**
     * 删除旧配置数据 每天夜里执行
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void DelOldData(){
         configDataMapper.delOldData();
    }


    @Scheduled(cron = "0 0/3 * * * ?")
    public void checkAndUpdateIP() throws Exception {
        alyDdnsUtil.updateAAAARecord();
    }
}
